//
//  BaseButtonView.m
//  ExcellentHome
//
//  Created by XXJ on 16/2/15.
//  Copyright © 2016年 陈区. All rights reserved.
//

#import "BaseButtonView.h"

@implementation BaseButtonView

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    self.backgroundColor = kColor_bg;
    _isClick = YES;
}

-(void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    self.backgroundColor = kColor_W;
    _isClick = NO;
    
}

-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    self.backgroundColor = kColor_W;
    if (_isClick)
    {
        _isClick = NO;
        [super sendActionsForControlEvents:UIControlEventTouchUpInside];
    }
    
}

-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    self.backgroundColor = kColor_W;
    _isClick = NO;
    
}

@end
